package com.example.boot.dlbigtype.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.boot.dlbigtype.dao.DlBigTypeMapper;
import com.example.boot.dlbigtype.model.DlBigType;
import com.example.boot.dlbigtype.service.DlBigTypeService;
import com.example.boot.dlgoodspic.dao.DlGoodsPicMapper;
import com.example.boot.util.PicURLEntity;

@Service
public class DlBigTypeImpl implements DlBigTypeService {
	@Autowired
	private DlBigTypeMapper dlBigTypeMapper;
	@Autowired
	private DlGoodsPicMapper dlGoodsPicMapper;
	@Autowired
	private PicURLEntity picURLEntity;

	@Override
	public List<DlBigType> findGoodsType() throws Exception {
		List<DlBigType> findSuperiorType = dlBigTypeMapper.findSuperiorType();
		for (DlBigType d : findSuperiorType) {
			d.setTypePicture(picURLEntity.getUrlPrefix() + d.getTypePicture());
			d.setTypeList(dlBigTypeMapper.bySuperiorIdFindType(d.getSuperiorId()));
			d.setGoodsPic(picURLEntity.getUrlPrefix() + dlGoodsPicMapper.byGoodsIdFindPic(d.getGoodsId()));
		}

		return findSuperiorType;
	}

}
